#! /usr/bin/env python
import rospy
from std_msgs.msg import Float64MultiArray

if __name__ == "__main__":
    #2.初始化 ROS 节点:命名(唯一)
    rospy.init_node("talker_p")
    #3.实例化 发布者 对象
    pub = rospy.Publisher("add_num",Float64MultiArray,queue_size=10)
    #4.组织被发布的数据，并编写逻辑发布数据
    datalist = [1, 2]
    # 设置循环频率
    rate = rospy.Rate(1)
    while not rospy.is_shutdown():

        #拼接字符串
        print("data 1: %d    data 2: %d", datalist[0], datalist[1])
        data=Float64MultiArray(data=datalist)
        pub.publish(data)
        rate.sleep()

